<script>

    $(function () {

        var form = new Vue({
            el:'#orderDetail',
            data:{
                doReply:true,
                replyContent:window.evaluate_content,
                replyTime:window.evaluate_time,
                viewOffer:false,
            },
            mounted:function(){
            },
            methods:{
                submit:function(event){
                    if (!validator.form()){
                        return
                    }

                    var self = this;
                    axios.post('/ajax/order/reply', $('#form').serialize())
                        .then(function (response) {
                            if (response.data.code == 200) {
                                alert('回复成功');
                                self.doReply = false;
                                self.replyContent = $('[name=reply]').val();
//                                self.replyTime = moment().format("X");
                                self.replyTime = response.data.timestamp;
                            } else {
                                alert(response.data.message || '回复失败');
                            }
                        },function (response) {
                            alert(response.data.message || '回复失败');
                        }).catch(function (err) {
                        alert('回复失败');
                    });
                }
            },
            components:{
            },
            computed:{
            },
        });

        var validator = $("#form").validate({
            rules: {
                order_id:{
                    required:true,
                },
                reply:{
                    required:true,
                },
            },
            messages: {
                reply:{
                    required:'请填写回复内容',
                },
            },
//            submitHandler: function(form) {
//                form.submit();
//            },
        });
    });
</script>